package com.hot100;

public class h055 {
    public static void main(String[] args) {
        int[] nums ={4,2,0,0,1,1,4,4,4,0,4,0};
        System.out.println(canJump(nums));
    }

    public static boolean canJump(int[] nums) {
        int max = nums[0];
        for (int i = 0; i < nums.length ;i++){
            if (i <= max)
            max = Math.max(max,i+nums[i]);
            if (max >= nums.length - 1) return true;
        }
        return false;
    }
}